<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

console.log("start");

setTimeout(() => {
console.log("setTimeout1");
}, 0);

(async function foo() {
console.log("async 1");
await asyncFunction();
console.log("async2");
})().then(console.log("foo.then"));

async function asyncFunction() {
console.log("asyncFunction");
setTimeout(() => {
console.log("setTimeout2");
}, 0);

new Promise((res) => {
console.log("promise1");
res("promise2");
}).then(console.log);
}
console.log("end");

    </script>
</body>
</html>